<div style="height: 500px; overflow-y: scroll; border: 1px solid #ccc;">
    <div style="height: 1500px; position: relative;">
        <div style="position: sticky; top: 10px; background: lightblue; padding: 10px; z-index: 10;">
            I'm fixed while scrolling!
        </div>
        <p>Scroll down to see the fixed behavior...</p>
        <p style="margin-top: 1000px;">More content here...</p>
    </div>
</div>